<template>
    <view>
        <template v-for="(item, index) in StorageInfo">
            <j-cell-group :key="index" :title="'磁盘' + (index + 1)">
                <j-cell title="磁盘物理序号" :tips="item.PlysicalNo" :more="false"></j-cell>
                <j-cell title="磁盘分区数" :tips="item.PartNumber" :more="false"></j-cell>
                <template v-for="(pro, size) in item.Partition">
                    <j-cell-card :key="pro.size" :title="'分区' + (size + 1)" :show="false" :is-touch="false" border style="background: #f5f7fb">
						<j-cell title="驱动器逻辑序号" :tips="pro.LogicSerialNo" :more="false"></j-cell>
						<j-cell title="是否为当前工作驱动器" :tips="pro.IsCurrent?'是':'否'" :more="false"></j-cell>
						
						<template v-if="pro.DirverType === 0">
							<j-cell title="磁盘类型" tips="读写盘" :more="false"></j-cell>
						</template>
						<template v-if="pro.DirverType === 1">
							<j-cell title="磁盘类型" tips="只读盘" :more="false"></j-cell>
						</template>
						<template v-if="pro.DirverType === 3">
							<j-cell title="磁盘类型" tips="冗余盘" :more="false"></j-cell>
						</template>
						<template v-if="pro.DirverType === 4">
							<j-cell title="磁盘类型" tips="快照盘" :more="false"></j-cell>
						</template>
                        
                        <j-cell title="总容量" :tips="Number(parseInt(pro.TotalSpace,16).toString(10)/1024).toFixed(2) + ' GB'" :more="false"></j-cell>
                        <j-cell title="剩余容量" :tips="Number(parseInt(pro.RemainSpace,16).toString(10)).toFixed(2) + ' MB'" :more="false"></j-cell>
                        <j-cell title="新录像文件开始时间" :tips="pro.NewStartTime" :more="false"></j-cell>
                        <j-cell title="新录像文件结束时间" :tips="pro.NewEndTime" :more="false"></j-cell>
                        <j-cell title="上一个录像文件开始时间" :tips="pro.OldStartTime" :more="false"></j-cell>
                        <j-cell title="上一个录像文件结束时间" :tips="pro.OldEndTime" :more="false"></j-cell>
                        <j-cell title="状态" :tips="pro.Status === 0 ? '正常': '错误'" :more="false"></j-cell>
                    </j-cell-card>
                </template>
            </j-cell-group>
        </template>
    </view>
</template>

<script>
export default {
    data() {
        return {
            token: '',
            StorageInfo: {},
			
        };
    }
    /**
     * 生命周期函数--监听页面加载
     */,
    onLoad: function (options) {
		console.log('=== StorageInfo:',options);
        this.token = options.token
        this.getinfo();
    },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {},
    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {},
    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {},
    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {},
    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {},
    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {},
    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {},
    methods: {
        getinfo() {
            uni.showLoading();
            let token = this.token;
            let data = {
                Name: 'StorageInfo'
            };
            getApp().globalData.api.getinfo(data, token, (result) => {
                uni.hideLoading({
                    success: (res) => {
                        console.log('====================获取信息：', result);
                        this.StorageInfo = result['StorageInfo']
                    }
                });
            });
        }
    }
};
</script>
<style></style>
